hourPossibilities = {
  0: ['0'],
  1: ['1', '2', '4', '8'],
  2: ['3', '5', '6', '9', '10'],
  3: ['7', '11']
}
minutePossibilities = {
  0: ['00'],
  1: ['01', '02', '04', '08', '16', '32'],
  2: ["09", "10", "12", "05", "06", "03", "17", "18", "20", "24", "33", "34", "36", "40", "48"],
  3: ["13", "14", "11", "07", "21", "22", "19", "25", "26", "28", "37", "38", "35", "41", "42", "44", "49", "50", "52", "56"],
  4: ["15", "23", "27", "29", "30", "39", "43", "45", "46", "51", "53", "54", "57", "58"],
  5: ["31", "47", "55", "59"]
}

resMap = {0: ['0:00']}

for num in range(1, 11):
    res = []
    for i in range(min(num, 3) + 1):
        j = num - i

        if j > 5:
            continue

        hourPs = hourPossibilities[i]
        minutePs = minutePossibilities[j]
        for m in range(len(hourPs)):
            for n in range(len(minutePs)): 
                res.append(hourPs[m] + ':' + minutePs[n])

    resMap[num] = res

class Solution(object):
    def readBinaryWatch(self, num):
        """
        :type num: int
        :rtype: List[str]
        """
        return resMap[num]
        
s = Solution()
print(s.readBinaryWatch(1))

